package com.century.sjt.EMChat.db;

import android.content.ContentValues;
import android.content.Context;

import com.century.sjt.EMChat.domain.Translate;

import java.util.List;

/**
 * Created by 炳基 on 2016/7/21.
 */
public class TranslateDao {
    static final String TABLE_NAME = "new_friends_translate";
    static final String COLUMN_NAME_ID = "id";
    static final String COLUMN_NAME_MSGID = "msgid";
    static final String COLUMN_NAME_MFROM = "mfrom";
    static final String COLUMN_NAME_FROMID = "fromid";
    static final String COLUMN_NAME_MTO = "mto";
    static final String COLUMN_NAME_DSC = "dst";
    static final String COLUMN_NAME_SRC = "src";
    static final String COLUMN_NAME_TIME = "time";
    static final String COLUMN_NAME_UNREAD_MSG_COUNT = "unreadMsgCount";


    public TranslateDao(Context context){
    }
    /**
     * 保存 Translate
     * @param
     * @return  返回这条Translate在db中的id
     */
    public Integer saveTranslateDao(Translate message){
        return DemoDBManager.getInstance().saveTranslate(message);
    }

    /**
     * 更新 Translate
     * @param msgId
     * @param values
     */
    public void updateTranslateDao(int msgId,ContentValues values){
        DemoDBManager.getInstance().updateTranslate(msgId, values);
    }

    /**
     * 获取 Translate
     * @return List<Translate>
     */
    public List<Translate> getTranslateDaoList(){
        return DemoDBManager.getInstance().getTranslateList();
    }
    /**
     * 获取 Translate
     * @return Translate
     */
    public Translate getTranslateDao(String mid){
        return DemoDBManager.getInstance().getTranslate(mid);
    }
    /**
     * 删除 Translate（个人记录）
     * @return
     */
    public void deleteTranslateDao(String fromid){
        DemoDBManager.getInstance().deleteTranslate(fromid);
    }
    /**
     * 删除 Translate（单条记录）
     * @return
     */
    public void deleteOneTranslateDao(String msgid){
        DemoDBManager.getInstance().deleteOneTranslate(msgid);
    }
    public int getUnreadTranslateDaoCount(){
        return DemoDBManager.getInstance().getTranslateUnreadNotifyCount();
    }

    public void saveUnreadTranslateDaoCount(int count){
        DemoDBManager.getInstance().setTranslateUnreadNotifyCount(count);
    }

}
